package com.yellowframework.cloud.domain.security.response;

import com.yellowframework.cloud.common.model.response.CommonCode;
import com.yellowframework.cloud.common.model.response.ResponseResult;
import com.yellowframework.cloud.common.model.response.ResultCode;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;

/**
 * Created by mrt on 2018/5/21.
 */
@EqualsAndHashCode(callSuper = true)
@Data
@NoArgsConstructor
public class LoginResult extends ResponseResult {

    private String token;

    public LoginResult(ResultCode resultCode, String token) {
        super(resultCode);
        this.token = token;
    }

    public static LoginResult success(String token){
        return new LoginResult(CommonCode.SUCCESS, token);
    }

    public static LoginResult fail(){
        return new LoginResult(CommonCode.FAIL, null);
    }

}
